package com.charity.rest.controller.manage.website;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.charity.website.vo.query.WebUserPageQuery;
import com.charity.website.service.IWebUserService;
import com.charity.website.vo.model.WebUserModel;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 网站用户  前端控制器
 *
 */
@RestController
@RequestMapping("/manage/manageWebUser")
@AllArgsConstructor
public class ManageWebUserController {
    
    private final IWebUserService webUserService;

    @PostMapping("/getPageList")
    public IPage<WebUserModel> getPageList(@RequestBody WebUserPageQuery query) {
        return webUserService.getPageList(query);
    }

    @GetMapping(value = "/{id}")
    public WebUserModel getWebUserById(@PathVariable("id") Long id) {
        return webUserService.getWebUserById(id);
    }

    @PostMapping("/createWebUser")
    public Long createWebUser(@RequestBody WebUserModel model) {
        return webUserService.createWebUser(model);
    }

    @PostMapping("/updateWebUser")
    public void updateWebUser(@RequestBody WebUserModel model) {
        webUserService.updateWebUser(model);
    }

    @DeleteMapping("/{id}")
    public Integer deleteWebUser(@PathVariable("id") Long id) {
        return webUserService.deleteWebUser(id);
    }
}
